import VueRouter from 'vue-router'
import Vue from 'vue'
// 引入全局组件
import Find from '../views/Find.vue'
import Part from '../views/Part.vue'
import My from '../views/My.vue'
import NotFound from '../views/NotFound.vue'
Vue.use(VueRouter)
//核心步骤配置路由对象
//路由规则
const routes = [
    {
        path: '/',
        redirect:'/find'
    },
  {
    //路径
    path: '/find',
    //组件
      component: Find,
    name:'find'
  },
  {//路径
    path: '/part',
    //组件
      component: Part,
      name: 'part'
    
  },
  {//路径
    path: '/my/:id',
    //组件
      component: My,
    name:'my'
    },
    {
        path: "*",
        component: NotFound
  }
]


const router = new VueRouter({
  //配置路由信息
    routes,
    linkActiveClass: 'active',
  linkExactActiveClass: 'e-active',
  mode: 'history'
})
export default router